Skip to content

feat(selection-polish): Linux 支持——fcitx5 插件热键路由 + PRIMARY 选区校验 - #927

Merged
appergb merged 2 commits into
betafrom
feat/selection-polish-linux
Aug 6, 2026
Merged

feat(selection-polish): Linux 支持——fcitx5 插件热键路由 + PRIMARY 选区校验#927
appergb merged 2 commits into
betafrom
feat/selection-polish-linux

Conversation

@appergb

@appergb appergb commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

目标

补齐 Linux 端选中润色:fcitx5 插件新增选区润色触发键信号路由(仿 QA 模式),Rust 侧同步 + 转发,选区插入前用 PRIMARY selection 重读做安全校验。与 Windows/macOS 保持一致(触发键 → 润色 → 替换选区)。

改动

  • src-tauri/src/linux_fcitx.rsSetSelectionPolishHotkeyRaw DBus 方法 + sync_selection_polish_bindingstart_dictation_signal_listener 新增 selection_polish_trigger 参数,SelectionPolishEvent 信号 → HotkeyEvent::SelectionPolishShortcutPressed;初始同步与 fcitx5 重启重同步均含选区润色触发键
  • src-tauri/src/hotkey.rs:Linux adapter update_modifier_shortcuts 转发 selection_polish_trigger(移除 disabled 注释)
  • src-tauri/src/coordinator/hotkey_loops.rs:Linux 启动 fcitx5 监听时传入 selection_polish_trigger
  • src-tauri/src/selection.rs:Linux 分支 is_captured = PRIMARY 读到选区即可开始;validate 重读 PRIMARY 与捕获文本比较(用户改选/清空 PRIMARY 即拒绝粘贴);selection_text_matches cfg 覆盖 linux
  • scripts/linux-fcitx5-plugin/openless.cppSelectionPolishEvent 信号 + SetSelectionPolishHotkeyRaw 方法(INI 持久化 SelectionPolishRawSym/States),按键分发仿 QA 模式

兼容性

  • Windows/macOS 行为零改动(Linux 分支 cfg 隔离)
  • 依赖:插件需重装新版 .so(scripts/inject-fcitx5-plugin.sh)后生效;Linux 上默认无触发键(用户可在设置里配置 modifier-only 键,如右 Alt)
  • 无新增权限/依赖

测试

  • macOS:cargo test(940 pass)+ npm run build 确认改动不破坏其他平台(Linux 分支代码由 Linux CI 编译验证)
  • Linux CI:cargo check + 契约(本机为 mac,fcitx 插件 .so 需 Linux 环境重编译安装后实测)

已知限制

  • Linux 端热键事件由 fcitx5 插件上报(Wayland/X11 均可);组合键(combo)仍沿用 QA 的插件路径,本轮只接 modifier-only 触发
  • 插件 .so 重编译安装无法在本机验证,需 Linux 环境执行 scripts/inject-fcitx5-plugin.sh

@appergb

appergb commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

重新触发 CI(checks 未注册)

@appergb appergb closed this Aug 5, 2026
@appergb appergb reopened this Aug 5, 2026
- linux_fcitx.rs:新增 SetSelectionPolishHotkeyRaw DBus 方法 + sync_selection_polish_binding;
  start_dictation_signal_listener 增加 selection_polish_trigger 参数,监听
  SelectionPolishEvent 信号 → HotkeyEvent::SelectionPolishShortcutPressed,
  初始同步与 fcitx5 重启重同步均含选区润色触发键
- hotkey.rs Linux adapter:update_modifier_shortcuts 转发 selection_polish_trigger
  (移除 disabled on Linux 注释)
- hotkey_loops.rs:Linux 启动 fcitx5 监听时传入 selection_polish_trigger
- selection.rs Linux 分支:is_captured = PRIMARY 读到选区即可;validate 重读
  PRIMARY 与捕获文本比较(用户改选/清空即拒绝粘贴);selection_text_matches
  cfg 覆盖 linux
- fcitx5 插件 openless.cpp:新增 SelectionPolishEvent 信号 +
  SetSelectionPolishHotkeyRaw 方法(INI 持久化 SelectionPolishRawSym/States),
  按键分发仿 QA 模式;需重装插件(scripts/inject-fcitx5-plugin.sh)生效
- 注:Linux 代码由 Linux CI 验证编译;fcitx 插件 .so 需 Linux 环境重编译安装
@appergb
appergb force-pushed the feat/selection-polish-linux branch from 020fedf to 2f6f4c5 Compare August 5, 2026 21:37
coordinator.rs 的 hotkey 安装路径调 start_dictation_signal_listener 时漏传
selection_polish_trigger(签名 7 参数只传 6 个),Linux CI E0061。hotkey_loops.rs
已传,此处遗漏导致 Linux 编译失败。
@appergb
appergb merged commit b68a590 into beta Aug 6, 2026
4 checks passed
H-Chris233 added a commit to bigsongeth/openless that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant